//
//  LoginTestVC.swift
//  GoAbroad
//
//  Created by Pink Snow on 2025/5/26.
//

import UIKit
import RxSwift
import RxCocoa
import NSObject_Rx
import AuthenticationServices
class LoginTestVC: UIViewController {
    var cre : ASAuthorizationAppleIDCredential?
    
    @IBOutlet weak var identitytoken: UILabel!
    @IBOutlet weak var authcode: UILabel!
    
    @IBOutlet weak var user: UILabel!
    @IBOutlet weak var email: UILabel!
    @IBOutlet weak var copyToken: UIButton!
    @IBOutlet weak var copyauth: UIButton!
    
    @IBOutlet weak var fullname: UILabel!
    override func viewDidLoad() {
        super.viewDidLoad()
        let identitoken  = cre?.identityToken?.base64EncodedString()
        identitytoken.text = "identititoken:" +  (identitoken ?? "")
        let auth = cre?.authorizationCode?.base64EncodedString()
        authcode.text = "authcode" + (auth ??  "")
        user.text = "user" + (cre?.user ?? "")
        email.text = "email" + ( cre?.email ?? "")
         fullname.text = "fullname" +  (cre?.fullName?.description ?? "")
        
        
        copyToken.rx.tap.subscribe { _ in
//            identitoken.co
            UIPasteboard.general.string = identitoken
            
        }.disposed(by: rx.disposeBag)
        
        copyauth.rx.tap.subscribe { _ in
            UIPasteboard.general.string = auth
            
            
        }.disposed(by: rx.disposeBag)
        
        // Do any additional setup after loading the view.
    }


    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
